package main

import (
	"fmt"
	"math/rand"
	"github.com/go-gitea/gitea"
)

func idgenA(donw <-chan struct{}) <-chan int {
	ch := make(chan int, 10)

	go func() {
		select {
		case ch <- rand.Int():
		case <-donw:
			break
		}
		close(ch)
	}()
	return ch
}
func idgenB(donw <-chan struct{}) <-chan int {
	ch := make(chan int, 10)
	go func() {
		select {
		case ch <- rand.Int():
		case <-donw:
			break
		}
		close(ch)
	}()
	return ch
}

func genId(donw <-chan struct{}) <-chan int {

	ch := make(chan int, 10)
	exit := make(chan struct{})
	go func() {
		select {
		case ch <- <-idgenB(exit):
		case ch <- <-idgenA(exit):
		case <-donw:
			fmt.Println("tuichu")
			exit <- struct{}{}
			exit <- struct{}{}
			break
		}
		close(ch)
	}()

	return ch

}

type stu struct {
	Name string
	name string
	Age  int `json:"age" `
}

func demo(arr []int) {
	fmt.Println("-----")
	fmt.Println(&arr)
	fmt.Println(cap(arr))
	arr = append(arr, 1)
	fmt.Println(&arr)
	fmt.Println(arr)
	fmt.Println(cap(arr))
	fmt.Println("-----")

}

func main() {

	var arr []int
	arr = append(arr, 1)
	arr = append(arr, 1)
	fmt.Println(&arr)

	fmt.Println(arr)
	demo(arr)
	demo(arr[1:])

}
